package com.letoy.edu.controller;

import com.letoy.edu.entity.MajorInfo;
import com.letoy.edu.service.MajorInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Api(value = "专业信息管理", tags = "专业信息API")
public class MajorInfoController {

    @Autowired
    MajorInfoService majorInfoService;

    @PostMapping("/major/getAllMajorInfo")
    @ApiOperation(value = "专业信息表查询所有", notes = "专业信息表查询所有")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> getAllMajorInfo() {
        return majorInfoService.getAllMajorInfo();
    }

    @PostMapping("/major/getMajorInfoByMajorId")
    @ApiOperation(value = "专业信息表根据专业ID查询", notes = "专业信息表根据专业ID查询")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> getMajorInfoByMajorId(int majorId) {
        return majorInfoService.getMajorInfoByMajorId(majorId);
    }

    @PostMapping("/major/insertMajorInfo")
    @ApiOperation(value = "专业信息表插入专业", notes = "专业信息表插入专业")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> insertMajorInfo(MajorInfo majorInfo) {
        return majorInfoService.insertMajorInfo(majorInfo);
    }

    @PostMapping("/major/updateMajorInfo")
    @ApiOperation(value = "专业信息表更新专业", notes = "专业信息表更新专业")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> updateMajorInfo(MajorInfo majorInfo) {
        return majorInfoService.updateMajorInfo(majorInfo);
    }

    @PostMapping("/major/deleteMajorInfo")
    @ApiOperation(value = "专业信息表删除专业", notes = "专业信息表删除专业")
    @ApiImplicitParam(value = "", name = "Authorization", paramType = "header", dataType = "String", required = true)
    private Map<String, Object> deleteMajorInfo(int majorId) {
        return majorInfoService.deleteMajorInfo(majorId);
    }

}
